Skip to content

log mingw cpuid guard application during install#265

Merged
kevinushey merged 1 commit into
masterfrom
log-mingw-cpuid-guard
Jul 24, 2026
Merged

log mingw cpuid guard application during install#265
kevinushey merged 1 commit into
masterfrom
log-mingw-cpuid-guard

Conversation

@kevinushey

Copy link
Copy Markdown
Contributor

Summary

patchTbbMachineHeader() previously exited silently in every case: header missing, guard already present, unexpected header form, and even on success. The unexpected-form case is the dangerous one -- it means the mingw cpuid guard is silently absent, which is exactly how the #248 fix turned out to be incomplete (only caught by manually diffing a real Rtools45 build; see #253).

This PR:

  • logs the normal outcomes (applied, already present, header not found) in the style of the provenance logging added in log tbb header and library provenance during install #256
  • emits a warning when the header exists but does not contain exactly one #include <intrin.h> line, so a reformatted Rtools/oneTBB header surfaces at install time rather than as a downstream mingw build failure
  • adds unit tests to tests/test-install-libs.R covering guard application, idempotency, and the malformed-header path (warning emitted, file left unmodified)

Testing

  • tests/test-install-libs.R passes (all 17 checks)
  • verified end-to-end with a full R CMD INSTALL on Linux; the install log now shows ** mingw cpuid guard already present in '../inst/include/oneapi/tbb/detail/_machine.h' (the bundled copy is patched at the source level)

patchTbbMachineHeader() previously exited silently in all cases: header
missing, guard already present, unexpected header form, and even success.
The unexpected-form case is dangerous -- it means the guard is absent and
mingw builds may fail (the same way the #248 fix was silently incomplete,
caught only by diffing a real Rtools45 build in #253).

Log the normal outcomes in the style of the provenance logging added in
#256, and emit a warning when the header does not have the expected form,
so a reformatted Rtools/oneTBB header surfaces at install time instead of
as a downstream build failure. Also add unit tests covering application,
idempotency, and the malformed-header path.
@kevinushey
kevinushey merged commit 0a650d9 into master Jul 24, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant